<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <button :disabled="falg">点击按钮</button>
        <h2 v-if="falg==true">{{num}}</h2>
        <h2 v-else>{{str}}</h2>
    </div>

    <script src="js/vue.js"></script>
    <script>
        let app = new Vue({
            el: "#app",
            data: {
                "falg": true,
                "num": 10,
                "str": "计时完成！！！"
            },
            mounted() {
                console.log(this.num);
                let timer = setInterval(() => {
                    if(this.num == 1){
                        clearInterval(timer);
                        this.falg = false;
                    }
                    this.num--;
                    console.log(this.num);
                }, 1000);
            }
        })
    </script>
</body>

</html>